#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
    int n = 0;
    int m = 2 * n - 1;
    int i, j;
    while (scanf("%d", &n) != EOF) {
        int m = n * 2 - 1;
        for (i = 1; i <= n; i++)
        {

            if (i == 1 || i == n)
            {
                for (j = 1; j <= n; j++) {
                    printf("* ");
                }
            }
            else
            {
                printf("*");
                for (j = 1; j <= m - 2; j++) {
                    printf(" ");
                }
                printf("*");
            }
            printf("\n");
        }
    }
    return 0;
}